package net.luoran.dvm.entity;

import lombok.Data;

/**
 * @author ：M1nG
 * @date ：Created in 2020/11/11 22:08
 * @description：
 * @version: 1.0
 */
@Data
public class ReleaseInfo {

    private String id;

    private String expireTime;

    private Integer repeatMinute;


    public ReleaseInfo() {

    }

    public ReleaseInfo(String id, String expireTime, Integer repeatMinute) {
        this.id = id;
        this.expireTime = expireTime;
        this.repeatMinute = repeatMinute;
    }

    public ReleaseInfo init(String str) {
        ReleaseInfo releaseInfo;
        String[] split = str.split("-");
        try {
            releaseInfo = new ReleaseInfo(split[0], split[1], Integer.valueOf(split[2]));
        } catch (NumberFormatException e) {
            return null;
        }
        return releaseInfo;
    }

    public String toStr() {
        return id + "-" + expireTime + "-" + repeatMinute;
    }
}
